<?php

namespace app\api\controller\v1;

use app\common\controller\BaseController;
use app\common\model\Topic as TopicModel;
use app\common\validate\TopicValidate;
use think\Request;

class Topic extends BaseController
{
    /**
     * 显示资源列表
     *
     * @return \think\Response
     */
     // 获取10个话题
    public function index()
    {
        $list = (new TopicModel())->gethotlist();

        return $this->showResCode('获取成功',['list' => $list]);
    }

    // 获取话题下的文章列表
    public function post($id)
    {
        (new TopicValidate())->goCheck('getpostlist');
        $list = (new TopicModel())->getPost();
        return $this->showResCode('获取成功',['list' => $list]);
    }
  
}
